# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>

pkgname=rocm-core
_rocm_major=5
_rocm_minor=4
_rocm_patch=3
_pkgver_magic=121
pkgver=$_rocm_major.$_rocm_minor.$_rocm_patch
pkgrel=4
pkgdesc='AMD ROCm core package (version files)'
license=('custom:None')
arch=('loong64' 'x86_64')
url='https://docs.amd.com/'

package() {
  # AMD hasn't released the complete source code of the package,
  # so we only package the version file that is needed for PyTorch
  echo "$pkgver-$_pkgver_magic" > version-rocm
  install -Dm644 version-rocm "$pkgdir/opt/rocm/.info/version"
  install -Dm644 version-rocm "$pkgdir/opt/rocm/.info/version-dev"

  echo "#pragma once" > rocm_version.h
  echo "#define ROCM_VERSION_MAJOR $_rocm_major" >> rocm_version.h
  echo "#define ROCM_VERSION_MINOR $_rocm_minor" >> rocm_version.h
  echo "#define ROCM_VERSION_PATCH $_rocm_patch" >> rocm_version.h
  install -Dm644 rocm_version.h "$pkgdir/opt/rocm/include/rocm_version.h"
  install -Dm644 rocm_version.h "$pkgdir/opt/rocm/include/rocm-core/rocm_version.h"
}
